//
//  ProductSpecsnapModel.swift
//
//  Created by eme on 2016/12/25
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol

class ProductSpecsnapModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kProductSpecsnapPsvalue2Key: String = "psvalue2"
    internal let kProductSpecsnapPsvalueKey: String = "psvalue"
    internal let kProductSpecsnapSkuidKey: String = "skuid"
    internal let kProductSpecsnapMesKey: String = "mes"
    
    
    // MARK: 属性
    var psvalue2: String
    var psvalue: String
    var skuid: Int
    var mes: String
    
    var rowHeight:CGFloat = 30
    
    
    // MARK: 实现ModelProtocol 协议， 解析json数据
    required  init?(json: JSON) {
        psvalue2 = json[kProductSpecsnapPsvalue2Key].stringValue
        psvalue = json[kProductSpecsnapPsvalueKey].stringValue
        skuid = json[kProductSpecsnapSkuidKey].intValue
        mes = json[kProductSpecsnapMesKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(psvalue2 as AnyObject, forKey: kProductSpecsnapPsvalue2Key)
        
        dictionary.updateValue(psvalue as AnyObject, forKey: kProductSpecsnapPsvalueKey)
        
        dictionary.updateValue(skuid as AnyObject, forKey: kProductSpecsnapSkuidKey)
        
        dictionary.updateValue(mes as AnyObject, forKey: kProductSpecsnapMesKey)
        
        
        return dictionary
    }
    
    
}
